# usage:
#		./jdk_install.sh open-jdk 16
#		./jdk_install.sh oracle-jdk 16
# switch: sudo update-alternatives --config java

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/$1-$2/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/$1-$2/bin/javac 1
sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/$1-$2/bin/javap 1
# jdk 8 以后要安装jshell
if [ $2 -gt 8 ]; then
	sudo update-alternatives --install /usr/bin/jshell jshell /usr/lib/jvm/$1-$2/bin/jshell 1
fi

echo "install $1-$2 successfully!"
